\(\int x^2 \tan ^2(a+i \log (x)) \, dx\) [144]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 62 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=6 e^{2 i a} x-\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}+x^2}-6 e^{3 i a} \arctan \left (e^{-i a} x\right ) \]

[Out]

6*exp(2*I*a)*x-1/3*x^3-2*exp(2*I*a)*x^3/(exp(2*I*a)+x^2)-6*exp(3*I*a)*arctan(x/exp(I*a))

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {4591, 456, 474, 470, 327, 209} \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-6 e^{3 i a} \arctan \left (e^{-i a} x\right )-\frac {2 e^{2 i a} x^3}{x^2+e^{2 i a}}+6 e^{2 i a} x-\frac {x^3}{3} \]

[In]

Int[x^2*Tan[a + I*Log[x]]^2,x]

[Out]

6*E^((2*I)*a)*x - x^3/3 - (2*E^((2*I)*a)*x^3)/(E^((2*I)*a) + x^2) - 6*E^((3*I)*a)*ArcTan[x/E^(I*a)]

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 456

Int[(x_)^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> Int[x^(m + n*(p + q
))*(b + a/x^n)^p*(d + c/x^n)^q, x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] && IntegersQ[p, q] &&
NegQ[n]

Rule 470

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*(e*x)^(m +
 1)*((a + b*x^n)^(p + 1)/(b*e*(m + n*(p + 1) + 1))), x] - Dist[(a*d*(m + 1) - b*c*(m + n*(p + 1) + 1))/(b*(m +
 n*(p + 1) + 1)), Int[(e*x)^m*(a + b*x^n)^p, x], x] /; FreeQ[{a, b, c, d, e, m, n, p}, x] && NeQ[b*c - a*d, 0]
 && NeQ[m + n*(p + 1) + 1, 0]

Rule 474

Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^2, x_Symbol] :> Simp[(-(b*c - a*
d)^2)*(e*x)^(m + 1)*((a + b*x^n)^(p + 1)/(a*b^2*e*n*(p + 1))), x] + Dist[1/(a*b^2*n*(p + 1)), Int[(e*x)^m*(a +
 b*x^n)^(p + 1)*Simp[(b*c - a*d)^2*(m + 1) + b^2*c^2*n*(p + 1) + a*b*d^2*n*(p + 1)*x^n, x], x], x] /; FreeQ[{a
, b, c, d, e, m, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && LtQ[p, -1]

Rule 4591

Int[((e_.)*(x_))^(m_.)*Tan[((a_.) + Log[x_]*(b_.))*(d_.)]^(p_.), x_Symbol] :> Int[(e*x)^m*((I - I*E^(2*I*a*d)*
x^(2*I*b*d))/(1 + E^(2*I*a*d)*x^(2*I*b*d)))^p, x] /; FreeQ[{a, b, d, e, m, p}, x]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\left (i-\frac {i e^{2 i a}}{x^2}\right )^2 x^2}{\left (1+\frac {e^{2 i a}}{x^2}\right )^2} \, dx \\ & = \int \frac {x^2 \left (-i e^{2 i a}+i x^2\right )^2}{\left (e^{2 i a}+x^2\right )^2} \, dx \\ & = -\frac {2 e^{2 i a} x^3}{e^{2 i a}+x^2}-\frac {1}{2} e^{-2 i a} \int \frac {x^2 \left (-10 e^{4 i a}+2 e^{2 i a} x^2\right )}{e^{2 i a}+x^2} \, dx \\ & = -\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}+x^2}+\left (6 e^{2 i a}\right ) \int \frac {x^2}{e^{2 i a}+x^2} \, dx \\ & = 6 e^{2 i a} x-\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}+x^2}-\left (6 e^{4 i a}\right ) \int \frac {1}{e^{2 i a}+x^2} \, dx \\ & = 6 e^{2 i a} x-\frac {x^3}{3}-\frac {2 e^{2 i a} x^3}{e^{2 i a}+x^2}-6 e^{3 i a} \arctan \left (e^{-i a} x\right ) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.10 (sec) , antiderivative size = 100, normalized size of antiderivative = 1.61 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-\frac {x^3}{3}+4 x \cos (2 a)-6 \arctan (x (\cos (a)-i \sin (a))) \cos (3 a)+4 i x \sin (2 a)+\frac {2 x (\cos (3 a)+i \sin (3 a))}{\left (1+x^2\right ) \cos (a)-i \left (-1+x^2\right ) \sin (a)}-6 i \arctan (x (\cos (a)-i \sin (a))) \sin (3 a) \]

[In]

Integrate[x^2*Tan[a + I*Log[x]]^2,x]

[Out]

-1/3*x^3 + 4*x*Cos[2*a] - 6*ArcTan[x*(Cos[a] - I*Sin[a])]*Cos[3*a] + (4*I)*x*Sin[2*a] + (2*x*(Cos[3*a] + I*Sin
[3*a]))/((1 + x^2)*Cos[a] - I*(-1 + x^2)*Sin[a]) - (6*I)*ArcTan[x*(Cos[a] - I*Sin[a])]*Sin[3*a]

Maple [A] (verified)

Time = 2.92 (sec) , antiderivative size = 48, normalized size of antiderivative = 0.77

method result size
risch \(-\frac {7 x^{3}}{3}+\frac {2 x^{3}}{1+\frac {{\mathrm e}^{2 i a}}{x^{2}}}+6 \,{\mathrm e}^{2 i a} x -6 \arctan \left (x \,{\mathrm e}^{-i a}\right ) {\mathrm e}^{3 i a}\) \(48\)

[In]

int(x^2*tan(a+I*ln(x))^2,x,method=_RETURNVERBOSE)

[Out]

-7/3*x^3+2*x^3/(1+exp(2*I*a)/x^2)+6*exp(2*I*a)*x-6*arctan(x*exp(-I*a))*exp(3*I*a)

Fricas [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.39 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-\frac {x^{5} - 11 \, x^{3} e^{\left (2 i \, a\right )} - 18 \, x e^{\left (4 i \, a\right )} + 9 \, {\left (i \, x^{2} e^{\left (3 i \, a\right )} + i \, e^{\left (5 i \, a\right )}\right )} \log \left (x + i \, e^{\left (i \, a\right )}\right ) + 9 \, {\left (-i \, x^{2} e^{\left (3 i \, a\right )} - i \, e^{\left (5 i \, a\right )}\right )} \log \left (x - i \, e^{\left (i \, a\right )}\right )}{3 \, {\left (x^{2} + e^{\left (2 i \, a\right )}\right )}} \]

[In]

integrate(x^2*tan(a+I*log(x))^2,x, algorithm="fricas")

[Out]

-1/3*(x^5 - 11*x^3*e^(2*I*a) - 18*x*e^(4*I*a) + 9*(I*x^2*e^(3*I*a) + I*e^(5*I*a))*log(x + I*e^(I*a)) + 9*(-I*x
^2*e^(3*I*a) - I*e^(5*I*a))*log(x - I*e^(I*a)))/(x^2 + e^(2*I*a))

Sympy [A] (verification not implemented)

Time = 0.17 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.06 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=- \frac {x^{3}}{3} + 4 x e^{2 i a} + \frac {2 x e^{4 i a}}{x^{2} + e^{2 i a}} - 3 \left (- i \log {\left (x - i e^{i a} \right )} + i \log {\left (x + i e^{i a} \right )}\right ) e^{3 i a} \]

[In]

integrate(x**2*tan(a+I*ln(x))**2,x)

[Out]

-x**3/3 + 4*x*exp(2*I*a) + 2*x*exp(4*I*a)/(x**2 + exp(2*I*a)) - 3*(-I*log(x - I*exp(I*a)) + I*log(x + I*exp(I*
a)))*exp(3*I*a)

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 254 vs. \(2 (45) = 90\).

Time = 0.31 (sec) , antiderivative size = 254, normalized size of antiderivative = 4.10 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-\frac {2 \, x^{5} - 22 \, x^{3} {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} - 36 \, x {\left (\cos \left (4 \, a\right ) + i \, \sin \left (4 \, a\right )\right )} - 18 \, {\left (x^{2} {\left (\cos \left (3 \, a\right ) + i \, \sin \left (3 \, a\right )\right )} + {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} \cos \left (3 \, a\right ) - {\left (-i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} \sin \left (3 \, a\right )\right )} \arctan \left (\frac {2 \, x \cos \left (a\right )}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}, \frac {x^{2} - \cos \left (a\right )^{2} - \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right ) + 9 \, {\left (x^{2} {\left (-i \, \cos \left (3 \, a\right ) + \sin \left (3 \, a\right )\right )} + {\left (-i \, \cos \left (2 \, a\right ) + \sin \left (2 \, a\right )\right )} \cos \left (3 \, a\right ) + {\left (\cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )} \sin \left (3 \, a\right )\right )} \log \left (\frac {x^{2} + \cos \left (a\right )^{2} + 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}{x^{2} + \cos \left (a\right )^{2} - 2 \, x \sin \left (a\right ) + \sin \left (a\right )^{2}}\right )}{6 \, {\left (x^{2} + \cos \left (2 \, a\right ) + i \, \sin \left (2 \, a\right )\right )}} \]

[In]

integrate(x^2*tan(a+I*log(x))^2,x, algorithm="maxima")

[Out]

-1/6*(2*x^5 - 22*x^3*(cos(2*a) + I*sin(2*a)) - 36*x*(cos(4*a) + I*sin(4*a)) - 18*(x^2*(cos(3*a) + I*sin(3*a))
+ (cos(2*a) + I*sin(2*a))*cos(3*a) - (-I*cos(2*a) + sin(2*a))*sin(3*a))*arctan2(2*x*cos(a)/(x^2 + cos(a)^2 - 2
*x*sin(a) + sin(a)^2), (x^2 - cos(a)^2 - sin(a)^2)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2)) + 9*(x^2*(-I*cos(
3*a) + sin(3*a)) + (-I*cos(2*a) + sin(2*a))*cos(3*a) + (cos(2*a) + I*sin(2*a))*sin(3*a))*log((x^2 + cos(a)^2 +
 2*x*sin(a) + sin(a)^2)/(x^2 + cos(a)^2 - 2*x*sin(a) + sin(a)^2)))/(x^2 + cos(2*a) + I*sin(2*a))

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 141 vs. \(2 (45) = 90\).

Time = 0.46 (sec) , antiderivative size = 141, normalized size of antiderivative = 2.27 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-\frac {x^{5}}{3 \, {\left (x^{2} + \frac {e^{\left (4 i \, a\right )}}{x^{2}} + 2 \, e^{\left (2 i \, a\right )}\right )}} + \frac {10 \, x^{3} e^{\left (2 i \, a\right )}}{3 \, {\left (x^{2} + \frac {e^{\left (4 i \, a\right )}}{x^{2}} + 2 \, e^{\left (2 i \, a\right )}\right )}} - 6 \, \arctan \left (x e^{\left (-i \, a\right )}\right ) e^{\left (3 i \, a\right )} + \frac {35 \, x e^{\left (4 i \, a\right )}}{3 \, {\left (x^{2} + \frac {e^{\left (4 i \, a\right )}}{x^{2}} + 2 \, e^{\left (2 i \, a\right )}\right )}} + \frac {2 \, x e^{\left (4 i \, a\right )}}{x^{2} + e^{\left (2 i \, a\right )}} + \frac {8 \, e^{\left (6 i \, a\right )}}{{\left (x^{2} + \frac {e^{\left (4 i \, a\right )}}{x^{2}} + 2 \, e^{\left (2 i \, a\right )}\right )} x} \]

[In]

integrate(x^2*tan(a+I*log(x))^2,x, algorithm="giac")

[Out]

-1/3*x^5/(x^2 + e^(4*I*a)/x^2 + 2*e^(2*I*a)) + 10/3*x^3*e^(2*I*a)/(x^2 + e^(4*I*a)/x^2 + 2*e^(2*I*a)) - 6*arct
an(x*e^(-I*a))*e^(3*I*a) + 35/3*x*e^(4*I*a)/(x^2 + e^(4*I*a)/x^2 + 2*e^(2*I*a)) + 2*x*e^(4*I*a)/(x^2 + e^(2*I*
a)) + 8*e^(6*I*a)/((x^2 + e^(4*I*a)/x^2 + 2*e^(2*I*a))*x)

Mupad [B] (verification not implemented)

Time = 27.68 (sec) , antiderivative size = 52, normalized size of antiderivative = 0.84 \[ \int x^2 \tan ^2(a+i \log (x)) \, dx=-6\,{\left ({\mathrm {e}}^{a\,2{}\mathrm {i}}\right )}^{3/2}\,\mathrm {atan}\left (\frac {x}{\sqrt {{\mathrm {e}}^{a\,2{}\mathrm {i}}}}\right )-\frac {x^3}{3}+4\,x\,{\mathrm {e}}^{a\,2{}\mathrm {i}}+\frac {2\,x\,{\mathrm {e}}^{a\,4{}\mathrm {i}}}{x^2+{\mathrm {e}}^{a\,2{}\mathrm {i}}} \]

[In]

int(x^2*tan(a + log(x)*1i)^2,x)

[Out]

4*x*exp(a*2i) - x^3/3 - 6*exp(a*2i)^(3/2)*atan(x/exp(a*2i)^(1/2)) + (2*x*exp(a*4i))/(exp(a*2i) + x^2)